<admintpl file="header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>补2016年12月结算明细</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('Finance/settl_make_list')}">
        跑客姓名：<input type="text" name="formget[dispatch_name]" style="width: 60px;" value="{$formget.dispatch_name}"><!--  placeholder="请输入..." -->
        电话：<input type="text" name="formget[mobile]" style="width: 85px;" value="{$formget.mobile}"><!--  placeholder="请输入..." -->
        所属团队：
        <select class="select_2" name="formget[company_id]"  style="width: 105px;" >
            <volist name="company_data" id="vo">
                <if condition="$formget.company_id == $vo[company_id]">
                <option value="{$vo.company_id}" selected>{$vo.company_name}</option>
                    <else /><option value="{$vo.company_id}" >{$vo.company_name}</option>
                </if>
            </volist>
        </select>
        结算月份：<input name="formget[settl_month]" id="settl_month" class="laydate-icon" style="width:100px;display:inline-block;vertical-align: middle;" value="{$formget.settl_month}" />
        <input type="submit" class="btn btn-primary" value="搜索" />
    </form>
    总数：{$total_count}人
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th align="center">序号</th>
                <th>所属团队</th>
                <th>分公司</th>
                <th>跑客姓名</th>
                <th>电话</th>
                <th>账户金额</th>
                <th>结算时间</th>
                <th>结算月份</th>
                <th>结算前账户金额</th>
                <th>结算金额</th>
                <th>提现总额</th>
                <th>结转跑腿工资</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <php>$account_statuses=array("1"=>'正常',"2"=>'停用',"3"=>'临时冻结');
                $signs=array("0"=>'未签约',"1"=>'未签约',"2"=>'已签约',"3"=>'已解约');

            </php>
            <foreach name="lists" item="vo" key="k">
                <tr>
                    <php>$name= urldecode($vo['dispatch_name']);</php>
                    <td align="center">{$k+1}</td>
                    <td>{$vo['company_id']|getCompanyName}</td>
                    <td>{$vo['company_branch']|get_combranch_name}</td>
                    <td>{$name}</td>
                    <td>{$vo['mobile']}</td>
                    <td>{$vo['cash_balance']}</td>
                    <td>{$vo['settl_time']}</td>
                    <td>{$vo['settl_month']}</td>
                    <td>{$vo['settl_cash_balance']}</td>
                    <td>{$vo['settl_amount']}</td>
                    <td>{$vo['cash_amount']}</td>
                    <td>{$vo['salary_amount']}</td>
                    <td><input  class="btn btn-primary btn-small"  type="button" onclick="set_pn_rob_order({$vo['dispatch_id']},{$vo['cash_balance']})" value="输入金额">
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <if condition="empty($lists)">
            <div style="padding: 30px;text-align: center;color: #999999">
                <i class="fa fa-database" style="font-size: 38px"></i><br />
                暂无数据
            </div>
        </if>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/laydate/laydate.js"></script>
<script>
    laydate({
        elem: '#settl_month',
        format: 'YYYY-MM', // 分隔符可以任意定义，该例子表示只显示年月
        festival: true, //显示节日
        choose: function(datas){ //选择日期完毕的回调
            //alert('得到：'+datas);
//            alert($("#settl_month").val());
        }
    });
    setCookie('refersh_time', 0);
    function refersh_window() {
        var refersh_time = getCookie('refersh_time');
        if (refersh_time == 1) {
            window.location = "{:U('Bdrunpeople/user',$formget)}";
        }
    }
    setInterval(function() {
        refersh_window();
    }, 2000);
    $(function() {
        setCookie("refersh_time", 0);
        Wind.use('ajaxForm', 'artDialog', 'iframeTools', function() {
            //批量移动
            $('.js-articles-move').click(function(e) {
                var str = 0;
                var id = tag = '';
                $("input[name='ids[]']").each(function() {
                    if ($(this).attr('checked')) {
                        str = 1;
                        id += tag + $(this).val();
                        tag = ',';
                    }
                });
                if (str == 0) {
                    art.dialog.through({
                        id : 'error',
                        icon : 'error',
                        content : '您没有勾选信息，无法进行操作！',
                        cancelVal : '关闭',
                        cancel : true
                    });
                    return false;
                }
                var $this = $(this);
            });
        });

    });

    /**
     * 设置跑客的个人可接单量
     */
    function set_pn_rob_order(dispatch_id,cash_balance) {
        if(cash_balance==null || cash_balance=="")
            cash_balance = 0;

        layer.prompt({title: '跑客账户余额【'+cash_balance+'】单，输入新可接单量：', formType: 3}, function(counts, index){
            layer.close(index);

            $.ajax({
                type: "GET",
                async: true,
                url: "{:U('Finance/settl_make_operate')}",//接单跑客的位置
                data:"id="+dispatch_id+"&counts="+counts,
                dataType: "json",
                success: function(data) {
//                    if(data == 1 )
//                        alert("设置成功");
//                    else
//                         alert("设置失败");
                    window.location.reload();
                }
            });
        });
    }
</script>
</body>
</html>